package com.jiazhong.shixi.caichanguanli.mapper;
import com.jiazhong.shixi.caichanguanli.bean.RepairRecords;
import org.apache.ibatis.annotations.Insert;
import com.jiazhong.shixi.caichanguanli.bean.Assets;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AssetsMapper {
    @Insert("INSERT INTO assets(asset_id,asset_name, supplier, purchase_date, purchase_price, asset_type, user_id) " +
            "VALUES(#{assetId},#{assetName}, #{supplier},#{purchaseDate},#{purchasePrice}, #{assetType}, #{userId})")
    //@Options(useGeneratedKeys = true, keyProperty = "assetId")
    void add(Assets sc);

    @Delete("DELETE FROM assets WHERE asset_id = #{assetId}")
    void deleteById(Assets sc);


    @Select("SELECT * FROM assets order by purchase_date asc")
    List<Assets> selectByDate();
}
